(define (monte-carlo trials experiment)
    (define (iter trials-remaining trials-passed)
        (cond 
            ((= trials-remaining 0)
                (/ (* trials-passed 1.0) (* trials 1.0)))
            ((experiment)
                (iter (- trials-remaining 1) (+ trials-passed 1))
            )
            (else (iter (- trials-remaining 1) trials-passed))
        )
    )
    (iter trials 0 )
)
(define (random-in-range low high)
    (let 
        (( range (- high low)))
        (+ low (random range))
    )
)
(define (pi-test)
    (let 
        (
            (x (random-in-range 0 10000))
            (y (random-in-range 0 10000))
            
        )    
        (if (< (sqrt (+ (* x x) (* y y))) 10000)
            #t
            #f
        )
    )
)

(display (* 4 (monte-carlo 1000000 pi-test)))
(newline)
(display (* 4 (monte-carlo 10000000 pi-test)))
(exit)